from django.forms import ModelForm
from django.forms import widgets as Fwidgets,fields as Ffields



def haldle_model(admin_class,add_data=False):
    class Meta:
        model=admin_class.model
        fields='__all__'
        if not add_data:
            exclude=admin_class.readonly_fields
    def __new__(cls,*args,**kwargs):
        for i in cls.base_fields:
            cls.base_fields[i].widget.attrs.update({'class':'form-control'})
        return ModelForm.__new__(cls)

    mdform=type('mdform',(ModelForm,),{'Meta':Meta,'__new__':__new__})

    return mdform
